<script>
jQuery(document).ready(function(){ 
        var manhours = "<%= @collaborator.manhours %>";
        jQuery('#manhours').displayPeriod({periods: manhours});
        var manweeks = "<%= @collaborator.manweeks %>";
        jQuery('#manweeks').displayPeriod({periods: manweeks, working: false});
});
</script>
<% form_remote_tag(:url => {:controller => 'collaborator', :action => params[:act]}, :loading => "TrackSuite.ajax.loadding('collaborator_submit','ajax20.gif');") do %>
<%= hidden_field_tag "act", params[:act] %>  
<%= hidden_field "collaborator", "id" %>
<%= error_messages_for "collaborator" %>
<table border="1">
<thead>
    <tr><td>Inclusão e alteração de colaboradores</td></tr>
</thead>
<tbody>
    <tr><td>Usuário:</td></tr>
    <tr><td><%= select("collaborator", "user_id", User.find(:all).collect {|p| [ p.name, p.id ] }, { :include_blank => true }) %></td></tr>
    <tr><td>
      <table>
        <thead>
            <tr><td>Horário de trabalho:</td></tr>
        </thead>
        <tbody>
            <tr><td><div id="manhours" style="display: none;"></div></td></tr>
            <tr><td>Alterar: <%= text_field "collaborator", "manhours" %> <%= link_to_function(image_tag("/images/icons/ok.png", :border => "0"), "jQuery('#manhours').displayPeriod({periods: jQuery('#collaborator_manhours').attr('value')})") %></td></tr>
        </tbody>
      </table>
    </td></tr>
    <tr><td>
      <table>
        <thead>
            <tr><td>Dias da semana de trabalho:</td></tr>
        </thead>
        <tbody>
            <tr><td><div id="manweeks" style="display: none;"></div></td></tr>
            <tr><td>Alterar: <%= text_field "collaborator", "manweeks" %> <%= link_to_function(image_tag("/images/icons/ok.png", :border => "0"), "jQuery('#manweeks').displayPeriod({periods: jQuery('#collaborator_manweeks').attr('value')})") %></td></tr>
        </tbody>
      </table>
    </td></tr>
</tbody>
<tfoot>
    <tr>
        <td align="right">
          <span id="collaborator_submit"><%= image_submit_tag "/images/icons/ok.png" %></span> 
          <%= link_to_function(image_tag("/images/icons/cancel.png", :border => "0"), "TrackSuite.util.element.hide('collaborator_form')") %>
        </td>
    </tr>
</tfoot>
</table>
<% end %>
